<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ include file="common/commonTopOther.jsp"%>
<!DOCTYPE HTML>
<html>

<head>
<title>注册页面</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css"
	media="all">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords"
	content="Aquaclub Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript">
	
			addEventListener("load", function() {
				setTimeout(hideURLbar, 0);
			}, false);

			function hideURLbar() {
				window.scrollTo(0, 1);
			}
			
			$("span.menu").click(function() {
				$(".head-nav ul").slideToggle(300, function() {
					// Animation complete.
				});
			});
			
			function btn1(){
			     document.getElementById("fm").action="register_register";
			     document.getElementById("fm").submit();
			    }
			   function btn2(){ 
			     document.getElementById("fm").action="register_register"; 
			     document.getElementById("fm").submit();
			    }
			   
			   function CheckInput()
			      //校验上传的文件是否为空，是否符合格式
			      {
			      //获取上传文件的url
			        var file =encodeURI(document.getElementById("file").value);
			        if(file == ""){
			           alert("文件不能为空!");
			           //返回false，不继续执行下一步
			           return false; 
			        }else{     
			           //获取上传文件的后缀名
			           var extension = file.substring(file.lastIndexOf('.'), file.length).toLowerCase();
			           //判断后缀名是否符合图片格式".jpg|.jpeg|.gif|.bmp|.png"
			           if(extension==".png"||extension==".jpg"||extension==".jpeg"||extension==".gif"||extension==".bmp"){
			           alert("上传成功");
			           document.getElementById("fm").action="photo_upLoadPhotos";
			           return true;
			           }else{
			           alert("上传的文件格式不对");
			           //返回false，不继续执行下一步
			           return false;
			           }             
			        }  
			      }  
		
</script>
<link
	href='http://fonts.useso.com/css?family=Open+Sans:400,300,600,700,800'
	rel='stylesheet' type='text/css'>
</head>

<body>

	<div class="main-1">
		<div class="container">
			<div class="register" style="margin-left: 14%;">
				<s:form action="" method="post" id="fm" namespace="/"
					enctype="multipart/form-data">
					<!-- 这里是隐藏标签，用于传照片路径 -->
					<input type="hidden" name="photo"
						value="<s:property value="#session.photo"/>">
					
					<div class="register-top-grid">
						<div class="wow fadeInLeft" data-wow-delay="0.4s">
							<span style="color: #080808;">邮箱<label>*</label></span>
							<s:textfield name="user.email" value="%{#session.email}" />
							<h3 style="color:white;"><s:fielderror>
								<s:param>email</s:param>
							</s:fielderror></h3>
						</div>
						<div class="wow fadeInRight" data-wow-delay="0.4s">
							<span style="color: #080808;">姓名<label>*</label></span>
							<s:textfield name="user.userName"/>
							<h3 style="color:white;"><s:fielderror>
								<s:param>userName</s:param>
							</s:fielderror></h3>
						</div>
						
						<div style="margin: 5px;"></div>
						
						<div class="wow fadeInRight" data-wow-delay="0.4s">
							<span style="color: #080808;">密码<label>*</label></span>
							<s:password name="user.password" value="%{#session.password}"/>
							<h3 style="color:white;"><s:fielderror>
								<s:param>password</s:param>
							</s:fielderror></h3>
						</div>

						<div class="wow fadeInRight" data-wow-delay="0.4s">
							<span style="color: #080808;">身份证号码<label
								style="color: #f06b59;">*（义工注册必填）</label></span>
							<s:textfield name="user.idCard" value="%{#session.idCard}" />
						</div>
						
						<div style="margin: 5px;"></div>
						
						<div class="wow fadeInRight" data-wow-delay="0.4s">
							<span style="color: #080808;">确认密码<label>*</label></span>
							<s:password />
						</div>
						<div class="wow fadeInLeft" data-wow-delay="0.4s">
							<span style="color: #080808;">联系方式<label>*</label></span>
							<s:textfield name="user.telephone" value="%{#session.telephone}" />
						</div>
 
                       <div style="margin: 5px;"></div>
				
                 <c:choose>
				   <c:when test="${photo==null}">
						<div class="wow fadeInRight">
							<div class="wow fadeInLeft" data-wow-delay="0.4s" id="photo">
								<span style="color: #080808;">照片<label
									style="color: #f06b59;">*</label></span> <img src="images/avatar.png"
									width="50%" height="50%" /> <input type="file" name="image"
									id="file"> <input type="submit" value="上传"
									onclick="return CheckInput()" />
							</div>
						</div>
					</c:when>
				    <c:otherwise>
				   
                    </c:otherwise>
				  </c:choose>
                          
						<div class="wow fadeInRight">
							<div class="wow fadeInLeft" data-wow-delay="0.4s">
								<span style="color: #080808;" >联系地址<label>*</label></span>
								<s:textfield name="user.address" style="width: 300px; height: 100px;"
									value="%{#session.address}" />
							</div>
						</div>

					</div>
			</div>
		</div>
		<div class="register-but">
			<ul style="list-style-type:none;">
				<li style="float:left"><input
					style="border:none;color:#ffffff;width:130px;height:50px; background: #f06b59;position:absolute;margin-left:251px ; margin-top:40px ;"
					type="button" value="义工注册" onclick="btn1()"></li>

				<li style="float: left;"><input
					style="border:none;color:#ffffff;width:130px;height:50px; background: #f06b59;position:absolute;margin-left:710px;margin-top:40px ;"
					type="button" value="求助者注册" onclick="btn2()"></a>
					<div class="clearfix"></div></li>
			</ul>
		</div>
		<div style="margin-top:150px;"></div>
		</s:form>
	</div>

	<div style="margin-top:100px;"></div>
</body>

</html>
<%@ include file="common/commonBottom.jsp"%>